package cn.biplam.front.component.view.systemManage.sysprivi.role.manage.navi;

import cn.biplam.common.ajxcode.SystemCode.RoleManageCode;
import cn.biplam.common.ajxcode.SystemCode.RoleManageNaviCode;
import cn.biplam.common.ajxcode.SystemCode.TreeDcIndexCode;
import cn.biplam.common.struc.SysStruc.RoleIndexStruc;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.data.tree.treebase.TreeCallBackNew;
import cn.biplam.front.component.data.tree.treebase.TreeDcIndex;
import cn.biplam.front.component.data.tree.treebase.Tree_Type.Tree_NodeType_Commen;
import cn.biplam.front.component.view.systemManage.sysprivi.role.RoleManage;
import cn.biplam.front.component.view.tree.TreeBase;
import cn.biplam.front.component.view.tree.TreeView;

/**
 *  角色导航树
 * @author XiaoRuxing Nov 2, 20094:35:59 PM
 * @version 1.0
 */
public class RoleNavi extends TreeView{

	public final static String cId=RoleManageNaviCode.cId;
	/** 树展开动作ID */
	public static final String Expand = RoleManageNaviCode.Navi;
	
	public RoleNavi() {
		super(Expand);
	}

	/**
	 * 传入树节点链接到的目标容器ID初始化
	 * @param targetId
	 */
	public void setTarget(String targetId) {
		this.targetId=targetId;
	}
	
	/**
	 * 设置树的数据信息
	 * @param treeBase			树的基础VC
	 * @param mUser				页面请求的用户类(由调用树的vc传入)
	 * @throws ErrorMessage
	 */
	@Override
	protected void setTree(TreeBase treeBase, UserInfo mUser)
			throws ErrorMessage {
		/**树的callback设置*/
		TreeCallBackNew callback = new TreeCallBackNew();
		//设置用户左键事件链接到显示角色信息
		callback.putLeftClick(Tree_NodeType_Commen.Leaf, RoleManageCode.Role_Info, this.targetId);
		//设置树DC
		treeBase.putTreeDc(1, 
				new TreeDcIndex(mUser,//用户信息
						RoleIndexStruc.Table_Name,   //用户索引表名
						null,
						"2"),
				callback);
		
		//在根主题节点上设置右键
		treeBase.putRightMenuItem(1, Tree_NodeType_Commen.RootTheme, TreeDcIndexCode.Add_Theme, "创建目录");
		//设置角色目录节点右键
		treeBase.putRightMenuItem(1, Tree_NodeType_Commen.SubTheme,  TreeDcIndexCode.Add_Theme, "创建目录");
		treeBase.putRightMenuItem(1, Tree_NodeType_Commen.SubTheme,  TreeDcIndexCode.Edit, "修改");
		treeBase.putRightMenuItem(1, Tree_NodeType_Commen.SubTheme,  RoleManage.Role_Dir_Del,   "删除");
		treeBase.putRightMenuItem(1, Tree_NodeType_Commen.SubTheme,  TreeDcIndexCode.Add_Leaf, "创建角色");
		//设置角色节点右键
		treeBase.putRightMenuItem(1, Tree_NodeType_Commen.Leaf, TreeDcIndexCode.Edit, "修改" );
		treeBase.putRightMenuItem(1, Tree_NodeType_Commen.Leaf, RoleManage.Role_Del, "删除" );
		//设置图片
	}
}
